class ContinentsController < ApplicationController
  include AuthenticatedSystem
  #before_filter :login_required
  #before_filter :admin_required, :only => [:edit]

  # GET /continents
  # GET /continents.xml
  def index
    @continents = Continent.find(:all)

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @continents }
    end
  end

  # GET /continents/new
  # GET /continents/new.xml
  def new
    @continent = Continent.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @continent }
    end
  end

  # GET /continents/1/edit
  def edit
    @continent = Continent.find(params[:id])
  end

  # POST /continents
  # POST /continents.xml
  def create
    @continent = Continent.new(params[:continent])

    respond_to do |format|
      if @continent.save
        flash[:notice] = 'Continent was successfully created.'
        format.html { redirect_to(continents_path) }
        format.xml  { render :xml => @continent, :status => :created, :location => @continent }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @continent.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /continents/1
  # PUT /continents/1.xml
  def update
    @continent = Continent.find(params[:id])

    respond_to do |format|
      if @continent.update_attributes(params[:continent])
        flash[:notice] = 'Continent was successfully updated.'
        format.html { redirect_to(continents_path) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @continent.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /continents/1
  # DELETE /continents/1.xml
  def destroy
    @continent = Continent.find(params[:id])
    @continent.destroy

    respond_to do |format|
      format.html { redirect_to(continents_url) }
      format.xml  { head :ok }
    end
  end
end
